var a = require("../../../@babel/runtime/helpers/toConsumableArray"), t = getApp();

Page({
    data: {
        detailId: null,
        goods: null,
        details: [],
        isMoreData: !0,
        loading: !1,
        page: 1
    },
    onLoad: function(a) {
        var t = parseInt(a.id);
        t ? (wx.setNavigationBarTitle({
            title: "库存明细"
        }), this.setData({
            detailId: t
        }), this.getDetails()) : wx.showToast({
            title: "库存明细不存在"
        });
    },
    onShareAppMessage: function() {},
    onShareTimeline: function() {},
    onReachBottom: function() {
        this.getDetails();
    },
    getDetails: function() {
        var e = this;
        if (!0 !== this.data.loading && !1 !== this.data.isMoreData) {
            this.setData({
                loading: !0
            }), wx.showLoading({
                title: "加载中",
                mask: !0
            });
            var i = t.getNetAddresss("plugin.agency.api.stock.log-list");
            i += "&page=" + this.data.page + "&goods_id=" + this.data.detailId, t._postNetWork({
                url: i,
                success: function(t) {
                    var i = t.data, s = i.data, o = i.result, d = i.msg;
                    if (0 === o) return wx.hideLoading(), void wx.showToast({
                        title: d,
                        success: function() {
                            wx.redirectTo({
                                url: "/packageG/member_v2/member_v2"
                            });
                        }
                    });
                    var n = {
                        loading: !1
                    };
                    null === e.data.goods && (n.goods = s.goods), (s.current_page === s.last_page || 0 === s.data.length || s.data.length < s.per_page) && (n.isMoreData = !1);
                    var l = e.data.details;
                    l.push.apply(l, a(s.data)), n.details = l, n.page = e.data.page + 1, e.setData(n), 
                    wx.hideLoading();
                }
            });
        }
    }
});